//
//  BaseTableViewController.swift
//  新浪weibo
//
//  Created by test on 15/7/28.
//  Copyright © 2015年 test. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate {


    var userLogon = UserAccount.userLogon
    var visitorView : VisitorLoginView?
    
    override func loadView() {
         userLogon ? super.loadView() : setupLogonView()
    }

    private func setupLogonView() {
        visitorView = VisitorLoginView()
        visitorView?.delegate = self
        view = visitorView
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorLoginViewWillLogin")
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorLoginViewWillRegister")
    
    }
    
    func visitorLoginViewWillLogin() {
        let nav = UINavigationController(rootViewController: OAuthViewController())
        
        presentViewController(nav, animated:true, completion: nil)
    }
    
    func visitorLoginViewWillRegister() {
        print(__FUNCTION__)
    }


}
